#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

class Solution {
public:
    int dx[4] = { 0,0,1,-1 };
    int dy[4] = { 1,-1,0,0 };

    void bfs(vector<vector<int>>& v, int x, int y)
    {
        for (int i = 0; i < 4; i++)
        {
            int a = x + dx[i], b = y + dy[i];
            if (a >= 0 && a < 4 && b >= 0 && b < 4)
            {
                v[a][b] ^= 1;
            }
        }
    }

    vector<vector<int> > flipChess(vector<vector<int> >& A, vector<vector<int> >& f) {
        for (auto e : f)
        {
            bfs(A, e[0] - 1, e[1] - 1);
        }

        return A;
    }
};

const int N = 1e5 + 10;
long long arr[N];
long long dp[N];
int main2()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
    }
    for (int i = 3; i <= n; i++)
    {
        dp[i] = max(dp[i - 3] + arr[i - 1], dp[i - 1]);
    }
    cout << dp[n];
    return 0;
}

typedef long long  ll;
ll a[N];
int n;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    sort(a, a + n);
    ll _max = INT_MIN;
    for (int i = 1; i < n; i++)
    {
        if (a[i] - a[i - 1] > _max)
        {
            _max = a[i] - a[i - 1];
        }
    }

    cout << _max << endl;

    return 0;
}